<template>
  <div class="test">
    <tl-sub-page :render="render" :visible.sync="visible" width="1000px" top="52px" v-dialogDrag :title="title" :close-on-click-modal="false" class="tl-dialog page" @open="open" @close="close" :append-to-body="true" :modal-append-to-body="true">
      <div style="position:relative;" v-if="isAdd && !microsourcetype">
        <el-button icon="el-icon-plus" style="position: absolute;top: -53px;right: 40px;" :type="'text'" @click="openAddDialog">周期会议创建</el-button>
      </div>
      <div style="position:relative;" v-if="!isAdd && meetSrc != '' && model.showqrcode">
        <el-button style="position: absolute;top: -53px;right: 40px;" :type="'text'" @click="viewImage(meetSrc)">会议二维码</el-button>
        <!--      <el-avatar shape="square" @click.stop="" style="position: absolute;top: -53px;right: 40px;" :size="100" :src="meetSrc"></el-avatar>-->
      </div>
      <div :id="viewerId"></div>
      <el-tabs class="tl-tabs" v-model="activeTab" type="card" @tab-click="tabClick">
        <el-tab-pane label="会议信息" name="basic">
          <div style="padding-left:30px;padding-bottom:10px">
            <el-row>
              <div class="square"></div>
              <label class="meetInfo">会议基本信息</label>
              <!--            <el-button type="text" @click="doQueryMeetRecord" v-if="model.state === 1 && (model.record === true || model.audio === true)" class="viewMeetRecord_link">查看会议资料</el-button>-->
            </el-row>
          </div>
          <el-form class="tl-form" ref="form" :model="model" :rules="rules" label-width="110px" :disabled="disableEditSubmit">
            <el-row>
              <el-col :span="24">
                <el-form-item label="会议主题" prop="name" :rules="rules.validateRequire">
                  <el-input v-model="model.name" maxlength="200" :placeholder="disableEditSubmit ? '' : '请输入会议主题'"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="会议内容" prop="content">
                  <el-input v-model="model.content" maxlength="200" type="textarea" :rows="2" :placeholder="disableEditSubmit ? '' : '请输入会议内容'"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8">
                <el-form-item label="开始时间" prop="begintimeDate" :rules="rules.validateRequire">
                  <el-date-picker v-model="model.begintimeDate" type="date" :placeholder="disableEditSubmit ? '' : '开始时间'" value-format="yyyy-MM-dd" :picker-options="expireTimeOption" @change="clearRoomAfterChangeTime"></el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="" label-width="10px" prop="begintimeTime" :rules="rules.validateRequire">
                  <el-time-select
                    @change="changeBegintimeTime"
                    v-model="model.begintimeTime"
                    :placeholder="disableEditSubmit ? '' : '选择时间'"
                    editable
                    :clearable="false"
                    :picker-options="{
                      start: '00:00',
                      step: '00:05',
                      end: '24:00'
                    }"
                  >
                  </el-time-select>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="结束时间" prop="endtimeDate" :rules="rules.validateRequire">
                  <el-date-picker v-model="model.endtimeDate" type="date" :placeholder="disableEditSubmit ? '' : '结束时间'" value-format="yyyy-MM-dd" :picker-options="expireTimeOption" @change="clearRoomAfterChangeTime"></el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="" label-width="10px" prop="endtimeTime" :rules="rules.validateRequire">
                  <el-time-select
                    @change="changeEndtimeTime"
                    v-model="model.endtimeTime"
                    :placeholder="disableEditSubmit ? '' : '选择时间'"
                    editable
                    :picker-options="{
                      start: '00:00',
                      step: '00:05',
                      end: '24:00'
                    }"
                  >
                  </el-time-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="会议类型" prop="meettypeid" :rules="rules.validateRequire">
                  <el-cascader v-model="model.selectmeettypelist" :options="meetTypeList" style="width:350px" filterable @change="handleMeetTypeChange" clearable></el-cascader>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="会议形式" prop="meetstyle" :rules="rules.validateRequire">
                  <el-select v-model="model.meetstyle" filterable clearable>
                    <el-option v-for="item in codeModel.meetstyleList" :key="item.code" :label="item.name" :value="item.code" />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="会议室" prop="meetroomid" v-if="showRoom">
                  <tl-ref-select-room v-model="model.meetroomid" :initDisplayData.sync="model.airlinecompany" :requireModel.sync="queryBoardItemModel" @open="initSelectMeetRoom" @openRoom="openSelectMeetRoom" @closeRoom="closeSelectMeetRoom" @updateRequire="updateRequire" :disabled="disabledRoom" sourceType="meetManage" @confirm="initPlace" @clearRoom="clearRoom" :currentRecord="this.model"></tl-ref-select-room>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="自定义地点" prop="place" v-if="showPlace">
                  <el-input v-model="model.place" maxlength="100" :disabled="disabledPlace" :placeholder="disabledPlace ? '' : '如果需要自定义会议地点，请在此输入'"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="远程会议信息" prop="remotemeetinfo">
                  <el-input v-model="model.remotemeetinfo" maxlength="1000" :placeholder="disableEditSubmit ? '' : '如：腾讯会议，会议号：1021902912'"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="会议标签" prop="keywords">
                  <el-input v-model="model.keywords" maxlength="200" :placeholder="disableEditSubmit ? '' : '会议关键字信息'"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <div v-if="showmainconfig">
              <div class="meetTitle">
                <div class="square"></div>
                <label class="meetInfo">会务配置</label>
              </div>
              <el-row>
                <el-col :span="24">
                  <tl-help style="position: absolute;left: 12px;top: 10px;">
                    音响设备使用说明：<br />
                    1、打开音响设备
                    <img style="width:35px" src="/static/images/meetRoom/switch.png" />
                    开关键，电脑插上音频线
                    <img style="width:35px" src="/static/images/meetRoom/audioLine.png" />
                    ，电脑自动弹出对话框“Realtek高清晰音频管理器”，选择“耳机”；<br />
                    2、调试电脑自带声音，鼠标右击电脑右下方
                    <img style="width:25px" src="/static/images/meetRoom/volume.png" />
                    键，打开声音设置，输出设备：扬声器，输入设备：麦克风阵列，可以进行公放视频。<br /><br />
                    <b>适用第三、第六视频会议设备：</b><br />
                    将宝利通视频设备USB插入电脑，右击电脑右下方
                    <img style="width:25px" src="/static/images/meetRoom/volume.png" />
                    键，打开声音设置，选择“回音消除话筒（Polycom Studio Audio）”，点击确定即可单独使用音频效果播放视频。视频会议设备连接电脑，进入腾讯会议，设置音频，即可完成视频会议连接。
                  </tl-help>
                  <el-form-item label="会议配置">
                    <el-checkbox-group v-model="selectedSourcelists">
                      <el-checkbox v-for="item in codeModel.sourcelistList" :key="item.code" :label="item.code.toString()">
                        {{ item.name }}
                      </el-checkbox>
                    </el-checkbox-group>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="24">
                  <el-form-item label="其他配置" prop="preparerequest">
                    <el-input v-model="model.preparerequest" type="textarea" :rows="2" />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="参会人数" prop="attendance" :rules="rules.validateRequire">
                    <el-input-number style="width: 350px" v-model="model.attendance"></el-input-number>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="24">
                  <el-form-item label="会务服务">
                    <el-checkbox-group v-model="selectedServices" @change="doSelectService">
                      <el-checkbox v-for="item in serviceList" :key="item.code" :label="item.code.toString()">
                        {{ item.name }}
                      </el-checkbox>
                    </el-checkbox-group>
                  </el-form-item>
                </el-col>
              </el-row>
            </div>
            <el-row v-if="service.welcomevisiable">
              <el-col :span="12">
                <el-form-item label="欢迎屏内容" prop="welcomeinfo" :rules="rules.validateRequire">
                  <el-input v-model="model.welcomeinfo" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="显示时间" prop="welcometime" :rules="rules.validateRequire">
                  <el-input v-model="model.welcometime" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row v-if="service.signvisiable || service.teavisiable">
              <el-col :span="12" v-if="service.signvisiable">
                <el-form-item label="桌签内容" prop="signinfo" :rules="rules.validateRequire">
                  <el-input v-model="model.signinfo" />
                </el-form-item>
              </el-col>
              <el-col :span="12" v-if="service.teavisiable">
                <el-form-item label="茶歇服务" prop="teainfo" :rules="rules.validateRequire">
                  <el-input v-model="model.teainfo" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row v-if="service.othervisiable">
              <el-col :span="24">
                <el-form-item label="其他" prop="otherservice" :rules="rules.validateRequire">
                  <el-input v-model="model.otherservice" type="textarea" :rows="2" />
                </el-form-item>
              </el-col>
            </el-row>
            <div class="meetTitle">
              <div class="square"></div>
              <label class="meetInfo">参会人员</label>
            </div>
            <el-row>
              <el-col :span="24">
                <el-form-item label="参会人员" :rules="rules.validateRequire">
                  <tl-ref-mulit-user-select v-model="users" :disabled="disableEditSubmit">
                    <template #button>
                      <el-button type="primary" v-if="showWhenMeetPublishAndEdit" plain size="mini" icon="el-icon-s-data" @click="openCountDialog">管理</el-button>
                    </template>
                  </tl-ref-mulit-user-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="发起人" prop="launchusername" :rules="rules.validateRequire">
                  <tl-ref-user v-model="model.launchusercode" :initDisplayData.sync="model.launchusername" dataType="code" :singleSelect="true" :disabled="disableEditSubmit" :externalQueryParam="{ qry_whereSql: 'EXTENDFIELD1 IS NOT NULL AND ENABLED = 1', qry_nodimission: '0' }"></tl-ref-user>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="会议秘书" prop="manageusercodes">
                  <tl-ref-user v-model="model.manageusercodes" :initDisplayData.sync="model.manageusernames" dataType="code" :singleSelect="false" :disabled="disableEditSubmit" :externalQueryParam="{ qry_whereSql: 'EXTENDFIELD1 IS NOT NULL AND ENABLED = 1', qry_nodimission: '0' }"></tl-ref-user>
                  <tl-help :placement="'left'" style="position: absolute;right: -25px;top: 0px;">
                    会议秘书拥有会议的管理权限，可以对会议进行编辑、上传文件等操作。
                  </tl-help>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="发起组织类型" prop="launchorgtype" :rules="rules.validateRequire">
                  <el-select v-model="model.launchorgtype" filterable clearable @change="clearOrgInfo">
                    <el-option v-for="item in codeModel.launchorgtypeList" :key="item.code" :label="item.name" :value="item.code" />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12" v-show="model.launchorgtype">
                <el-form-item label="发起组织" prop="launchorgname" :rules="rules.validateRequire">
                  <tl-ref-dept v-show="model.launchorgtype === 'dept'" v-model="model.launchorgindex" :initDisplayData.sync="model.launchorgname" nameType="fullname" dataType="code" :singleSelect="true" :disabled="disableEditSubmit"></tl-ref-dept>
                  <tl-ref-list v-show="model.launchorgtype === 'team'" v-model="model.launchorgindex" :initDisplayData.sync="model.launchorgname" refTitle="管理团队选择" dataType="id" :queryDataUrl="url.queryTeamList" :singleSelect="true" :disabled="disableEditSubmit"></tl-ref-list>
                </el-form-item>
              </el-col>
            </el-row>
            <div class="meetTitle">
              <div class="square"></div>
              <label class="meetInfo">通知配置</label>
            </div>
            <tl-remind-config v-model="remindList"></tl-remind-config>
          </el-form>
        </el-tab-pane>
        <el-tab-pane v-if="isAttendUser" label="会议议程" name="meetAgenda">
          <tl-meet-agenda ref="meetAgenda" v-if="model.id" :tempUsersParam="users" :sourceMeetID="model.id" :isSubPage="true" :isReadOnly="sourceType !== 'meetCreate' || model.state === 2" :meetBegintime="`${this.model.begintimeDate} ${this.model.begintimeTime}`" :meetEndtime="`${this.model.endtimeDate} ${this.model.endtimeTime}`"></tl-meet-agenda>
        </el-tab-pane>
        <el-tab-pane v-if="isAttendUser" label="会前资料" name="beforeminutes">
          <upload-comp ref="beforeAttachment" :editable="disableEditSubmit === false" :disabled="isAdd" sourceType="meetRecord" :sourceId="parseInt(model.meetnum)" :extendData="{ description: 'before' }" :limitSize="102400"></upload-comp>
        </el-tab-pane>
        <el-tab-pane v-if="!isAdd && (model.state === 1 || model.state === 3) && new Date().getTime() > new Date(model.endtime).getTime()" label="会议决议" name="desicion">
          <div style="padding-left:30px;padding-bottom:10px">
            <el-row>
              <div class="square"></div>
              <label class="meetInfo">会议决议内容</label>
            </el-row>
          </div>
          <el-form class="tl-form" ref="form2" :model="model" :rules="rules" label-width="110px" :disabled="disableEditSubmit">
            <el-row>
              <el-col :span="24">
                <el-form-item label="决议内容">
                  <el-input type="textarea" rows="4" v-model="model.desicion" maxlength="2000" @change="decisionChange" :placeholder="disableEditSubmit ? '' : '请输入会议决议'"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </el-tab-pane>
        <el-tab-pane v-if="showMoreTab" label="会议纪要" name="minutes">
          <upload-comp ref="attachment" :editable="disableEditSubmit === false" :disabled="isAdd" sourceType="meetRecord" :sourceId="parseInt(model.meetnum)" :extendData="{ description: 'after' }" :limitSize="102400"></upload-comp>
        </el-tab-pane>
        <el-tab-pane v-if="showMoreTab" label="已下发任务项" name="taskManage">
          <tl-task-manage ref="taskManage" :sourceType="sourceType" :sourceMeetID="model.meetnum" :isSubPage="true" :isReadOnly="disableEditSubmit"></tl-task-manage>
        </el-tab-pane>
        <el-tab-pane v-if="showMoreTab" label="录音文件" name="file">
          <tl-file-manage ref="fileManage" v-if="activeTab === 'file'" sourceType="meetRecord" :sourceId="model.meetnum" :isSubPage="true" :isReadOnly="disableEditSubmit"></tl-file-manage>
        </el-tab-pane>
      </el-tabs>
      <div slot="footer" class="dialog-footer">
        <el-button :type="disableEditSubmit === false ? 'text' : 'primary'" v-if="!microsourcetype" @click="doCancelEdit">取消</el-button>
        <el-button type="primary" @click="doSubmitEdit" :loading="saveLoading" v-if="model.state !== 1 && model.state !== 3 && !disableEditSubmit"><svg-icon icon-class="save" />暂存</el-button>
        <el-button type="primary" @click="doSubmitIssue" :loading="saveLoading" v-if="!disableEditSubmit"><svg-icon icon-class="send" />发布</el-button>
        <el-button type="primary" @click="doCancelMeet" :loading="saveLoading" v-if="showWhenMeetPublishAndEdit"><svg-icon icon-class="undo" />取消会议</el-button>
        <el-button type="primary" icon="el-icon-remove-outline" @click="doStopSign" :loading="saveLoading" v-if="showStopSign">停止签到</el-button>
        <el-button type="primary" v-if="showWhenMeetPublishAndEdit && microsourcetype" icon="el-icon-s-data" @click="openCountDialog">参会人员管理</el-button>
        <el-button type="primary" icon="el-icon-share" @click="doCopyInvite" :loading="saveLoading" v-if="model.state === 1 && model.attend === true">复制邀请</el-button>
        <el-button type="primary" @click="viewImage(meetSrc)" v-if="!isAdd && meetSrc != '' && model.showqrcode">
          <svg-icon icon-class="qr-code-svgrepo-com" style="height: 14px; width: 14px" />
          会议二维码
        </el-button>
      </div>
      <tl-meet-record-edit ref="meetRecordEditForm" :sourceType="sourceType"></tl-meet-record-edit>
      <conflict-list ref="conflictList" :dataList="conflictList"></conflict-list>
      <!--会议邀请-->
      <tl-invite ref="inviteForm" :content="inviteContent" :isReadOnly="disableEditSubmit"></tl-invite>
      <period-edit ref="periodEdit"></period-edit>
      <tl-count @refreshUser="queryUser" ref="countForm" sourceType="meetCreate"></tl-count>
    </tl-sub-page>
  </div>
</template>
<script>
/** mixins */
import { mixin_edit } from "@tapui/mixins/mixin_edit"
import { formatDate } from "@tapui/utils/date"
import { queryDataCode } from "@tapui/api/dataCode"
/** 子组件 */
import tlMeetAgenda from "@/views/meet/meetAgenda/index"
import tlMeetRecordEdit from "@/views/meet/meetRecord/edit"
import tlRefSelectRoom from "@/views/meet/meetRoomManage/selectRoomIndex"
import tlRefMeetType from "@/views/meet/meetTypeManage/refMeetType"
import tlRefMulitUserSelect from "@/components/common/refMulitUserSelect"
import tlRemindConfig from "@/components/common/remindConfig"
import conflictList from "@/views/work/workSchedule/conflictList"
import tlInvite from "@/views/meet/meetManage/invite"
import periodEdit from "@/views/meet/meetPeroidTask/edit"
import tlRecordBasic from "@/views/meet/meetRecord/basicComp"
import tlTaskManage from "@/views/meet/taskManage/index"
import tlFileManage from "@/views/meet/fileManage/index"
import uploadComp from "@/views/meet/meetRecord/uploadComp"
import tlCount from "@/views/meet/meetManage/count"
/** 工具类 */
import { putAction, getAction, postAction, deleteAction } from "@tapui/utils/http"
import _ from "lodash"
import axios from "@tapui/utils/request"
import Viewer from "viewerjs"
import { Promise, reject } from "q"
/** VUE配置 */
export default {
  mixins: [mixin_edit],
  components: { tlCount, tlRecordBasic, tlTaskManage, tlFileManage, uploadComp, tlMeetAgenda, tlRefSelectRoom, tlRefMeetType, tlMeetRecordEdit, tlRefMulitUserSelect, tlRemindConfig, conflictList, tlInvite, periodEdit },
  data() {
    return {
      moduleTitle: "会议",
      urlPrefix: "/meet/meetManage/",
      activeTab: "basic",
      url: {
        add: "/meet/meetManage/save",
        edit: "/meet/meetManage/save",
        // 主表更新接口
        update: "/meet/meetManage/update",
        queryTeamList: "base/teamInfo/list", // 查询团队
        queryVisibleTeamList: "base/teamInfo/list?qry_visible=1", // 查询可见团队
        getMeetRecord: "meet/record/queryRecordByMeet", // 得到会议资料
        publishMeet: "meet/meetManage/publish", // 发布会议
        cancelMeet: "meet/meetManage/cancel", // 取消会议
        stopSign: "/meet/meetManage/stopSign",
        queryUser: "/base/permissionManage/queryList", // 查询人员
        queryRemind: "/base/remindConfig/list", // 查询通知配置,
        queryMeetPersonCount: "/meet/meetManage/queryMeetPersonCount",
        queryMeetTypeList: "/meet/typeManage/queryTreeList",
        queryConflict: "/base/permissionManage/checkTimeConflict",
        judgeIsAttendUser: "/base/permissionManage/judgeIsAttendUser", // 查询是否为参会人员
        queryQRCode: "/cbo/attachment/queryAttachmentList", // 查询二维码
        download: "/cbo/attachment/download"
      },
      queryBoardItemModel: {
        begintime: "",
        endtime: "",
        count: 0
      },
      teamRefTitle: "团队选择",
      isQueryInitData: true,
      selectedMembers: {},
      isMemberSearch: false,
      activeNames: ["baseinfo", "place", "launchorg", "notice"],
      users: {
        usernames: "",
        usercodes: "",
        deptnames: "",
        deptcodes: "",
        teamids: "",
        teamnames: "",
        roleids: "",
        rolenames: ""
      },
      remindTypeList: [],
      noticeTypeList: [],
      remindUnitTypeList: [],
      remindList: [], // 提醒,
      selectmeettypelist: [],
      meetTypeList: [],
      conflictList: [],
      selectedSourcelists: [],
      selectedServices: [],
      serviceList: [{ code: "welcomevisiable", name: "欢迎屏准备" }, { code: "signvisiable", name: "桌签准备" }, { code: "teavisiable", name: "茶歇准备" }, { code: "othervisiable", name: "其他" }],
      service: {
        welcomevisiable: false,
        signvisiable: false,
        teavisiable: false,
        othervisiable: false
      },
      expireTimeOption: {
        disabledDate(date) {
          // 当天可选
          return date.getTime() < Date.now() - 24 * 60 * 60 * 1000
        }
      },
      inviteContent: "",
      isAttendUser: true,
      // 是否能上传会前资料
      canUpload: true,
      // 会议二维码路径
      meetSrc: "",
      imageViewer: null,
      viewerId: "viewer",
      imageList: [],
      // 微前端调用该组件时传递的参数，用于区分是从哪个系统创建的会议
      microsourcetype: "",
      sourceid: 0,
      sourceapp: "",
      // 微前端传参会人
      attendcodes: "",
      attendnames: "",
      // 控制结束时间是否根据开始时间变更
      endtimeChangeNoMore: false,
      // 决议变更标志字段
      decisionChanged: true
    }
  },
  props: {
    sourceType: {
      type: String,
      default: "meetCreate"
    },
    render: {
      default: "el-dialog",
      type: String
    }
  },
  computed: {
    // 计算参会人员数目
    attendUserCount() {
      let count = 0
      for (let index in this.model.basesharelist) {
        let item = this.model.basesharelist[index]
        if (item.sharetype === "attend" && item.allusernames) {
          count = item.allusernames.split(",").length
          break
        }
      }
      return count
    },
    // 当会议已发布时 且可以编辑时 显示
    showWhenMeetPublishAndEdit() {
      return !this.isAdd && (this.model.state === 1 || this.model.state === 3) && !this.disableEditSubmit
    },
    showWhenMeetPublish() {
      return !this.isAdd && (this.model.state === 1 || this.model.state === 3)
    },
    // 当会议已发布时 且可以编辑时 显示
    showStopSign() {
      return this.showWhenMeetPublishAndEdit && this.model.signstate === 1 && this.model.sourceapp === "mpm"
    },
    // 控制是否显示会务配置
    showmainconfig() {
      return this.model && this.model.meetroomtype === "company"
    },
    disabledPlace() {
      return this.model.hasOwnProperty("airlinecompany") && this.model.airlinecompany !== null && this.model.airlinecompany !== ""
    },
    disabledRoom() {
      return this.model.hasOwnProperty("place") && this.model.place !== null && this.model.place !== ""
    },
    /**
     * 会议发布后 控制会议 纪要 决议 展示
     */
    showMoreTab() {
      // 微前端引用 对所有能看到会议的人开放纪要、录音权限
      if (this.microsourcetype) {
        return this.showWhenMeetPublish
      } else {
        // 本系统中  只有参会人能看到
       return this.showWhenMeetPublish && this.isAttendUser
      }
    },
    showRoom() {
      if (this.disableEditSubmit) {
        return this.disabledPlace
      } else {
        return true
      }
    },
    showPlace() {
      if (this.disableEditSubmit) {
        return this.disabledRoom
      } else {
        return true
      }
    }
  },
  methods: {
    loaded() {
      if (this.render === "div") {
        this.$nextTick(() => {
          document.body.className = "hide-modal"
        })
      }
      if (!this.model.id && !this.isAdd) {
        this.$tap.alert("找不到该会议！", "warning")
        // 如果查询结果为空则通知调用该组件的系统该会议已删除
        this.$emit("meetNotFound")
        return
      }
      // 通知调用该组件的系统当前会议是否已上传会议纪要
      this.$emit("isUploadedRecord", this.model.recorduploaded === 1)
      // 若是其他系统通过微前端调用该组件，则向model中赋来源类型等信息
      if (this.microsourcetype) {
        this.$set(this.model, "sourcetype", this.microsourcetype)
        this.$set(this.model, "sourceid", this.sourceid)
        this.$set(this.model, "sourceapp", this.sourceapp)
      }
      this.viewerId = "viewer" + Math.floor(Math.random() * 100)
      // 新建会议时，页面加载完毕执行
      if (this.model.state === 2) {
        this.disableEditSubmit = true
      }
      // 设置初始页签为会议基本信息
      this.activeTab = "basic"
      this.isMemberSearch = false
      this.remindId = -1
      if (!this.isAdd) {
        // 编辑
        this.queryRemind()
        this.queryUser()
        // 判断是否是参会人员，从而判断是否显示会议议程tab标签
        this.judgeIsAttendUser()
        this.qryQRCode()
      } else {
        // 新增时设置默认值
        this.setDefaultValue()
      }
      this.processTime()
      this.setRoomConfigData()
      // 处理销售项目 创建提示
      if (this.isAdd && this.microsourcetype) {
        this.handleMpmPopDialog()
      }
    },
    handleMpmPopDialog() {
      if (this.microsourcetype === "MpmProject") {
        this.$tap.alert("省区所有项目会议要求项目的各组长及以上人员全部参加！")
      }
    },
    // 处理会务配置数据
    setRoomConfigData() {
      // 将会议室配置转成数组类型
      if (this.model.sourcelist) {
        this.selectedSourcelists = this.model.sourcelist.split(",")
      } else {
        this.selectedSourcelists = []
      }
      // 会议服务
      this.selectedServices = []
      if (this.model.welcomeinfo) {
        this.selectedServices.push("welcomevisiable")
      }
      if (this.model.signinfo) {
        this.selectedServices.push("signvisiable")
      }
      if (this.model.teainfo) {
        this.selectedServices.push("teavisiable")
      }
      if (this.model.otherservice) {
        this.selectedServices.push("othervisiable")
      }
      this.doSelectService()
    },
    doSelectService() {
      Object.keys(this.service).forEach(key => {
        if (this.selectedServices.includes(key)) {
          this.service[key] = true
        } else {
          this.service[key] = false
          if (key === "welcomevisiable") {
            this.$set(this.model, "welcomeinfo", "")
            this.$set(this.model, "welcometime", "")
          }
          if (key === "signvisiable") {
            this.$set(this.model, "signinfo", "")
          }
          if (key === "teavisiable") {
            this.$set(this.model, "teainfo", "")
          }
          if (key === "othervisiable") {
            this.$set(this.model, "otherservice", "")
          }
        }
      })
    },
    // 处理时间拆分
    processTime() {
      // 时间拆分
      if (this.model.begintime) {
        let beginArr = this.model.begintime.split(" ")
        this.$set(this.model, "begintimeDate", beginArr[0])
        this.$set(this.model, "begintimeTime", beginArr[1].substring(0, 5))
      } else {
        this.$set(this.model, "begintimeDate", "")
        this.$set(this.model, "begintimeTime", "")
      }
      if (this.model.endtime) {
        let endArr = this.model.endtime.split(" ")
        this.$set(this.model, "endtimeDate", endArr[0])
        this.$set(this.model, "endtimeTime", endArr[1].substring(0, 5))
      } else {
        this.$set(this.model, "endtimeDate", "")
        this.$set(this.model, "endtimeTime", "")
      }
    },
    setDefaultValue() {
      this.$set(this.model, "enabled", 1)
      this.$set(this.model, "sortcode", 0)
      this.$set(this.model, "launchusercode", this.user.code)
      this.$set(this.model, "launchusername", this.user.name)
      this.$set(this.model, "usercode", this.user.code)
      this.$set(this.model, "username", this.user.name)
      this.$set(this.model, "telephone", this.user.mobile)
      this.$set(this.model, "launchorgtype", "dept")
      this.$set(this.model, "launchorgindex", this.dept.code)
      this.$set(this.model, "launchorgname", this.dept.fullname)
      // 会议形式设置默认值：线下(code为1)
      this.$set(this.model, "meetstyle", "1")
      // 时间默认值
      if (!this.model.begintime) {
        let now = new Date()
        let dateBegin = formatDate(now, "yyyy-MM-dd HH:mm:ss")
        now.setHours(now.getHours() + 1)
        let dateEnd = formatDate(now, "yyyy-MM-dd HH:mm:ss")
        this.$set(this.model, "begintime", `${dateBegin}`)
        this.$set(this.model, "endtime", `${dateEnd}`)
      }
      var usercodes = ""
      var usernames = ""
      if (this.attendcodes) {
        if (("," + this.attendcodes + ",").indexOf("," + this.user.code + ",") >= 0) {
          usercodes = this.attendcodes
          usernames = this.attendnames
        } else {
          usercodes = this.attendcodes + "," + this.user.code
          usernames = this.attendnames + "," + this.user.name
        }
      } else {
        usercodes = this.user.code
        usernames = this.user.name
      }
      this.users = {
        usernames: usernames,
        usercodes: usercodes,
        deptnames: "",
        deptcodes: "",
        teamids: "",
        teamnames: "",
        roleids: "",
        rolenames: ""
      }
      // 默认
      this.remindList = [
        {
          id: 0,
          remindtype: "1",
          noticetype: "app",
          unit: "1",
          value: 1,
          timeValue: "09:00:00"
        }
      ]
    },
    // tab切换
    tabClick(tab) {
      let tabName = tab.name
      if (!this.model.id && tabName !== "basic") {
        this.$nextTick(_ => {
          this.activeTab = "basic"
        })
        this.$tap.confirm("会议未创建，是否立即创建会议？").then(_ => {
          this.doCreate().then(_ => {
            this.activeTab = tabName
            this.loadTab(tabName)
          })
        })
      } else {
        this.loadTab(tabName)
      }
    },
    // 判断要切换到那个tab页 并初始化 页面需要数据
    loadTab(tabName) {
      if (tabName === "meetAgenda") {
        this.$nextTick(_ => {
          this.$refs.meetAgenda.loadData({})
          if (this.sourceType !== "meetCreate" || this.model.state === 2) {
            this.$refs.meetAgenda.setDblClickActionType("view")
          } else {
            this.$refs.meetAgenda.setDblClickActionType("edit")
          }
        })
      } else if (tabName === "taskManage") {
        this.$nextTick(_ => {
          this.$refs.taskManage.loadData({})
        })
      } else if (tabName === "beforeminutes") {
        this.$nextTick(_ => {
          this.$refs.beforeAttachment.initData()
        })
      } else if (tabName === "minutes") {
        this.$nextTick(_ => {
          this.$refs.attachment.initData()
        })
      } else if (tabName === "file") {
        this.$nextTick(_ => {
          this.$refs.fileManage.loadData({})
        })
      } else if (tabName === "recordBasic") {
        this.$set(this.$refs.recordBasic, "id", this.model.recordid)
        this.$nextTick(_ => {
          this.$refs.recordBasic.open()
        })
      } else if (tabName === "microminutes") {
        this.$nextTick(_ => {
          this.$refs.microAttachment.initData()
        })
      }
    },
    /** 重写新建会议的方法，点击tab页创建会议时不需要关闭对话框 */
    doCreate() {
      let that = this
      return new Promise(function(re, rj) {
        that.$refs.form.validate(valid => {
          if (valid) {
            if (!that.beforeSubmit()) return
            that.saveLoading = true
            // 增加唯一单号
            postAction(that.url.add + "?billuid=" + that.uid, that.model)
              .then(res => {
                if (res.success) {
                  let meetType = that.model.selectmeettypelist
                  that.model = res.result
                  that.model.selectmeettypelist = meetType
                  // 处理时间
                  that.processTime()
                  that.isAdd = false
                  that.$emit("refresh")
                  re()
                } else {
                  rj()
                  that.$tap.alert(res.message, "warning")
                }
                that.afterSubmit()
                that.saveLoading = false
              })
              .catch(err => {
                rj()
                that.saveLoading = false
              })
          } else {
            rj()
          }
        })
      })
    },
    /** 重写编辑，发请求获得数据 */
    queryData(id) {
      if (!this.url.load) {
        this.$tap.alert("请设置load地址!", "warning")
        return
      }
      return getAction(this.url.load, { id: id, operatetype: this.sourceType }).then(res => {
        if (res.success) {
          this.model = res.result
        } else {
          this.$tap.alert(res.message, "warning")
        }
      })
    },
    /** 打开会议室列表，初始化 */
    initSelectMeetRoom() {
      this.$set(this.queryBoardItemModel, "begintimeTime", `${this.model.begintimeTime}`)
      this.$set(this.queryBoardItemModel, "endtimeTime", `${this.model.endtimeTime}`)
      this.$set(this.queryBoardItemModel, "begintimeDate", `${this.model.begintimeDate}`)
      this.$set(this.queryBoardItemModel, "endtimeDate", `${this.model.endtimeDate}`)
      this.$set(this.queryBoardItemModel, "count", this.attendUserCount)
    },
    /** 打开会议室列表 */
    openSelectMeetRoom() {
      this.$emit("openRoom")
    },
    /** 关闭会议室列表 */
    closeSelectMeetRoom() {
      this.$emit("closeRoom")
    },
    /** 更新会议室选择数据*/
    updateRequire(requireModel) {
      this.queryBoardItemModel = requireModel
      this.$set(this.model, "begintimeTime", this.queryBoardItemModel.begintimeTime)
      this.$set(this.model, "begintimeDate", this.queryBoardItemModel.begintimeDate)
      this.$set(this.model, "endtimeTime", this.queryBoardItemModel.endtimeTime)
      this.$set(this.model, "endtimeDate", this.queryBoardItemModel.endtimeDate)
      this.$set(this.model, "meetroomtype", this.queryBoardItemModel.meetroomtype)
    },
    // 当切换组织类型时，清空组织信息
    clearOrgInfo() {
      this.$set(this.model, "launchorgindex", "")
      this.$set(this.model, "launchorgname", "")
    },
    // 会议室选择后，初始化自定义会议地点
    initPlace(item) {
      // 若选择的是公司级会议室则显示会务配置，否则隐藏，并清空数据
      if (item.type !== "company") {
        this.hideAndClearRoomConfig()
      }
      // 会议室不在默认赋值自定义地点
      // this.$set(this.model, 'place', item.name + '(' + item.locationdesc + ')')
      this.$set(this.model, "place", "")
    },
    hideAndClearRoomConfig() {
      // 清空会议服务数据
      this.selectedServices = []
      this.doSelectService()
      this.$set(this.model, "sourcelist", "")
      this.$set(this.model, "preparerequest", "")
      this.$set(this.model, "attendance", "")
    },
    // 清除会选择议室信息
    clearRoom() {
      this.$set(this.model, "meetroomtype", "")
      this.$set(this.model, "meetroomid", "")
      this.$set(this.model, "airlinecompany", "")
      this.$set(this.model, "place", "")
    },
    /** 提交前检查 */
    beforeSubmit() {
      this.model.begintime = `${this.model.begintimeDate} ${this.model.begintimeTime}`
      this.model.endtime = `${this.model.endtimeDate} ${this.model.endtimeTime}`
      let beginTime = new Date(this.model.begintime)
      let endTime = new Date(this.model.endtime)
      if (endTime <= beginTime) {
        this.$tap.alert("会议结束时间不能早于会议开始时间！")
        return false
      }
      // 人员组装
      if (this.users.usercodes.length === 0 && this.users.deptcodes.length === 0 && this.users.teamids.length === 0 && this.users.roleids.length === 0) {
        this.$tap.message("请选择参会人", "error")
        return false
      }
      this.model.selectUsers = this.users
      // 提醒配置组装
      let remindList = []
      this.remindList.forEach((remind, index) => {
        remindList.push({
          id: remind.id,
          remindtype: remind.remindtype,
          unit: remind.unit,
          value: remind.remindtype === "1" ? remind.value : remind.timeValue,
          noticetype: remind.noticetype,
          sortcode: index
        })
      })
      this.model.remindList = remindList
      // 拼接会议配置，并赋值
      this.model.sourcelist = this.selectedSourcelists.join(",")
      return true
    },
    /** 重写新增提交，不关闭对话框 */
    doAdd() {
      this.saveLoading = true
      // 增加唯一单号
      postAction(this.url.add + "?billuid=" + this.uid, this.model)
        .then(res => {
          if (res.success) {
            this.$tap.message("添加成功", "success")
            let meetType = this.model.selectmeettypelist
            this.model = res.result
            this.model.selectmeettypelist = meetType
            // 处理时间
            this.processTime()
            this.isAdd = false
            this.$emit("refresh")
            // 通知调用该组件的其他系统组件
            this.$emit("saveMeet", res.result)
          } else {
            this.$tap.alert(res.message, "warning")
          }
          this.afterSubmit()
          this.saveLoading = false
        })
        .catch(err => {
          this.saveLoading = false
        })
    },
    /** 重写编辑提交，不关闭对话框 */
    doEdit() {
      this.saveLoading = true
      putAction(this.url.edit, this.model)
        .then(res => {
          if (res.success) {
            this.$tap.message(res.message, "success")
            this.$emit("refresh")
          } else {
            this.$tap.alert(res.message, "warning")
          }
          this.afterSubmit()
          this.saveLoading = false
        })
        .catch(err => {
          this.saveLoading = false
        })
    },
    // 执行发布会议
    async doSubmitIssue() {
      try {
        this.saveLoading = true
        let valid = await this.beforeSubmitIssue()
        // 获取实际邀请人数
        let personCountRes = await postAction(this.url.queryMeetPersonCount, this.users)
        let personcount = personCountRes.result
        // 获取地点
        let place = ""
        if (this.model.place || this.model.airlinecompany) {
          place = this.model.place ? this.model.place : this.model.airlinecompany
        }
        let confirmVnode = await this.renderPublishVnode()
        this.$confirm(confirmVnode, "会议发布确认")
          .then(_ => {
            this.checkConflict()
          })
          .catch(_ => {
            this.saveLoading = false
          })
      } catch (err) {
         this.saveLoading = false
      }
    },
    /**
     * 渲染会议发布 messagebox中提示内容
     * @return {Vnode}
     */
    async renderPublishVnode() {
      // 获取实际邀请人数
      let personCountRes = await postAction(this.url.queryMeetPersonCount, this.users)
      let personCount = personCountRes.result
      let headernode = <h4 class='publish-msg-box-header'>您将于 {this.model.begintime} 召开本次会议</h4>
      let footnode = <h4>请确认是否发布会议？发布后会通知参会人</h4>
      let placeNode
      let placeNodeLabel
      let place = ""
      if (this.model.place || this.model.airlinecompany) {
        place = this.model.place ? this.model.place : this.model.airlinecompany
      }
      if (place !== "") {
        placeNodeLabel = <div class='cell'>会议地点</div>
        placeNode = <div class='cell' >{place}</div>
      }
      let timeNodeLabel = <div class='cell'>会议时间</div>
      let timeNode = (
        <div class='cell'>
          {this.model.begintime} 至 {this.model.endtime}{" "}
        </div>
      )
      let personNodeLabel = <div class='cell'>邀请人数</div>
      let personNode = <div class='cell'>{personCount} 人</div>
      // 因为此处 async 返回 promise对象 需直接resolve
      return Promise.resolve(
        <div >
          <div>{headernode}</div>
          <div class='table'>
            <div class='row '>
              {timeNodeLabel}{timeNode}
            </div>
            <div class='row'>{personNodeLabel}{personNode}</div>
            {this.place !== "" ? <div class='row' >{ placeNodeLabel }{ placeNode }</div> : <div></div>}
          </div>
          <div>{footnode}</div>
        </div>
      )
    },
    async beforeSubmitIssue() {
      // 表单校验
      let valid = await this.$refs.form.validate().catch(() => {
        return Promise.reject()
      })
      return new Promise((resolve, reject) => {
        // before 进行时间地点校验
        if (!this.beforeSubmit() || !valid) {
          this.saveLoading = false
          reject()
        } else {
          resolve()
        }
      })
    },
    // 取消会议室审批，将会议状态置为作废
    doCancelMeet() {
      let that = this
      this.$tap
        .confirm("是否将会议作废？作废后不可恢复！")
        .then(_ => {
          that.saveLoading = true
          postAction(this.url.cancelMeet, this.model).then(res => {
            if (res.success) {
              this.disableEditSubmit = true
              this.$tap.message(res.message, "success")
              this.$emit("refresh")
              // 通知调用该组件的其他系统组件
              this.$emit("cancelMeet")
              that.saveLoading = false
              this.visible = false
            } else {
              this.$tap.alert("作废失败", "warning")
              that.saveLoading = false
            }
          })
        })
        .catch(_ => {
          that.saveLoading = false
        })
    },
    doStopSign() {
      let that = this
      this.$tap
        .confirm("是否停止该会议签到？该操作不可撤销！")
        .then(_ => {
          that.saveLoading = true
          postAction(this.url.stopSign, { meetid: this.model.id }).then(res => {
            if (res.success) {
              this.$tap.message(res.message, "success")
              this.$emit("refresh")
              this.$set(this.model, "signstate", 0)
              that.saveLoading = false
            } else {
              this.$tap.alert(res.message, "warning")
              that.saveLoading = false
            }
          })
        })
        .catch(_ => {
          that.saveLoading = false
        })
    },
    /** 会议资料 */
    doQueryMeetRecord() {
      getAction(this.url.getMeetRecord, { qry_meetid: this.model.id })
        .then(res => {
          if (res.success) {
            this.$refs.meetRecordEditForm.id = res.result.id
            this.$refs.meetRecordEditForm.visible = true
            this.$refs.meetRecordEditForm.isAdd = false
            if (this.sourceType === "meetCreate") {
              this.$refs.meetRecordEditForm.disableEditSubmit = false
              this.$refs.meetRecordEditForm.sourceType = "meetCreate"
            } else {
              this.$refs.meetRecordEditForm.sourceType = "meetSearch"
              this.$refs.meetRecordEditForm.disableEditSubmit = true
            }
          } else {
            this.$tap.alert(res.message, "warning")
          }
        })
        .catch(err => {
          this.saveLoading = false
        })
    },
    // 查询提醒配置
    queryRemind() {
      getAction(this.url.queryRemind, { qry_sourcetype: "MeetManage", qry_sourceid: this.model.id }).then(res => {
        if (res.success) {
          this.remindList = []
          res.result.dataList.forEach(m => {
            this.remindList.push({
              id: m.id,
              remindtype: m.remindtype,
              noticetype: m.noticetype,
              unit: m.unit,
              value: m.remindtype === "1" ? m.value : "1",
              timeValue: m.remindtype === "2" ? m.value : "09:00:00"
            })
          })
        }
      })
      // 保存旧
      this.oldRemindList = JSON.parse(JSON.stringify(this.remindList))
    },
    // 查询人员
    queryUser() {
      this.saveLoading = true
      getAction(this.url.queryUser, { qry_sourcetype: "MeetManage", qry_sourceid: this.model.id }).then(res => {
        if (res.success) {
          this.users = {
            usernames: "",
            usercodes: "",
            deptnames: "",
            deptcodes: "",
            teamids: "",
            teamnames: "",
            roleids: "",
            rolenames: ""
          }
          res.result.forEach(m => {
            if (m.sharetype === "5") {
              this.users.usernames = m.shareobjectsdesc
              this.users.usercodes = m.shareobjects
            } else if (m.sharetype === "1") {
              this.users.deptnames = m.shareobjectsdesc
              this.users.deptcodes = m.shareobjects
            } else if (m.sharetype === "3") {
              this.users.rolenames = m.shareobjectsdesc
              this.users.roleids = m.shareobjects
            } else if (m.sharetype === "2") {
              this.users.teamnames = m.shareobjectsdesc
              this.users.teamids = m.shareobjects
            }
          })
          this.saveLoading = false
        }
      }).catch(err => {
          this.saveLoading = false
      })
    },
    handleMeetTypeChange(value) {
      if (typeof value !== "undefined") {
        this.model.meettypeid = value[value.length - 1]
      }
    },
    // 日程冲突检测
    checkConflict() {
      let param = {
        ...this.users,
        begintime: this.model.begintime,
        endtime: this.model.endtime,
        sourceid: this.model.id,
        sourcetype: "MeetManage"
      }
      getAction(this.url.queryConflict, param)
        .then(res => {
          if (res.success) {
            this.conflictList = res.result
            if (res.result.length > 0) {
              this.$confirm("所选会议参会人中存在日程时间冲突，是否继续发布？", "提示", {
                confirmButtonText: "查看冲突",
                cancelButtonText: "忽略冲突继续发布",
                type: "warning",
                distinguishCancelAndClose: true
              })
                .then(() => {
                  // 查看冲突
                  this.$refs.conflictList.visible = true
                  this.saveLoading = false
                })
                .catch(action => {
                  // 忽略继续保存
                  if (action === "cancel") {
                    this.publishMeet()
                  } else {
                    this.saveLoading = false
                  }
                })
            } else {
              // 没有冲突
              this.publishMeet()
            }
          } else {
            // 调用接口出错了
            this.conflictList = []
            this.publishMeet()
          }
        })
        .catch(_ => {
          // 调用接口出错了
          this.conflictList = []
          this.publishMeet()
        })
    },
    // 发布会议
    publishMeet() {
      this.saveLoading = true
      postAction(this.url.publishMeet, this.model).then(res => {
        if (res.success) {
          this.$tap.message(res.message, "success")
          this.$emit("refresh")
          if (this.microsourcetype) {
            // 通知调用该组件的其他系统组件
            this.$emit("saveMeet", res.result)
            this.saveLoading = false
            this.queryData(res.result.id).then(_ => {
              this.isAdd = false
              this.loaded()
            })
          } else {
            this.saveLoading = false
            this.visible = false
          }
        if (this.microsourcetype && this.microsourcetype === "MpmProject") {
            this.$tap.alert("会议开始前，请先组织参会人员使用鼎信管理平台APP扫码签到！漏签或新增参会人员，会后请会议创建人或会议秘书在“参会人员”模块补签，谢谢！")
          }
        } else {
          this.$tap.alert(res.message, "warning")
          this.saveLoading = false
        }
      })
    },
    /** 复制邀请 */
    doCopyInvite() {
      this.inviteContent = "会议主题: " + this.model.name + "\r\n\r"
      this.inviteContent += "会议时间: " + this.model.begintime + "至" + this.model.endtime + "\r\n\r"
      this.inviteContent += "会议号: " + this.model.meetnum + "\r\n\r"
      this.inviteContent += "打开鼎信管理平台app-会议管理-输入会议号即可加入会议"
      this.$refs.inviteForm.open()
    },
    /** 查询用户是否为该会议的参会人员 */
    judgeIsAttendUser() {
      getAction(this.url.judgeIsAttendUser, { qry_sourcetype: "MeetManage", qry_sourceid: this.model.id }).then(res => {
        if (res.success) {
          this.isAttendUser = res.result.isAttendUser
        }
      })
    },
    /** 打开编辑周期会议对话框 */
    openAddDialog() {
      this.visible = false
      this.$refs.periodEdit.isAdd = true
      this.$refs.periodEdit.visible = true
      this.$refs.periodEdit.disableEditSubmit = false
    },
    /** 人员统计对话框 */
    openCountDialog() {
      let id = this.model.id
      this.$refs.countForm.id = id
      this.$refs.countForm.visible = true
      this.$refs.countForm.clickBtn = ""
      this.$refs.countForm.meetTitle = this.model.name
      this.$refs.countForm.queryParam = { qry_meetid: id }
      this.$refs.countForm.showSpecialContent = this.model.sourceapp === "mpm"
      this.$refs.countForm.doQuery()
      this.$refs.countForm.queryPersonStaticCount()
    },
    /** 查询会议的二维码 */
    qryQRCode() {
      getAction(this.url.queryQRCode, { qry_sourceType: "meetJoin", qry_sourceId: this.model.meetnum }).then(res => {
        if (res.success) {
          if (res.result && res.result.length > 0) {
            let attachmentId = res.result[0].id
            axios({
              url: this.url.download,
              method: "post",
              data: { attachmentId: attachmentId },
              responseType: "arraybuffer"
            }).then(response => {
              this.meetSrc = "data:image/png;base64," + this.$tap.util.bufferToBase64(response)
              this.imageList.push(this.meetSrc)
            })
          }
        } else {
          this.$tap.alert(res.message, "warning")
        }
      })
    },
    close() {
      this.meetSrc = ""
      this.endtimeChangeNoMore = false
      this.imageList = []
      // 当组件被其他系统引用时，通知父组件关闭事件
      this.$emit("cancel")
    },
    viewImage(src) {
      // for (let item of this.imageList) {
      //   if (!item.ex_base64) this.asyncDisplay(item)
      // }
      if (!this.imageViewer) {
        this.imageViewer = new Viewer(document.getElementById(this.viewerId), {
          url(str) {
            return str
          },
          title: [1, "参会二维码"]
        })
      }
      this.imageViewer.options.zIndex = 666666
      this.imageViewer.images = this.imageList
      this.imageViewer.length = this.imageViewer.images.length
      let idx = this.imageList.findIndex(item => item === src)
      this.imageViewer.index = idx
      this.imageViewer.show()
    },
    changeBegintimeTime() {
      if (!this.endtimeChangeNoMore) {
        let begindate = new Date(`${this.model.begintimeDate} ${this.model.begintimeTime}`)
        // 加9 是因为ISO默认时区为UTC+0  需要utc+8 +1
        let enddate = new Date(begindate.setHours(begindate.getHours() + 9))
        this.model.endtimeDate = enddate.toISOString().substring(0, 10)
        this.model.endtimeTime = enddate.toISOString().substring(11, 16)
        this.clearRoomAfterChangeTime()
      }
    },
    changeEndtimeTime() {
      this.endtimeChangeNoMore = true
      this.clearRoomAfterChangeTime()
    },
    /** 清空已选会议室 **/
    clearRoomAfterChangeTime() {
      if (this.model.meetroomid) {
        this.$tap.alert("为避免时间冲突，请重新选择会议室！")
        this.clearRoom()
      }
    },
    // 防抖函数自动保存
    decisionChange: _.debounce(function() {
      let saveInfo = {
        id: this.model.id,
        desicion: this.model.desicion ? this.model.desicion : ""
      }
      putAction(this.url.update, saveInfo).then(res => {
        if (res) {
          this.$tap.message("保存成功")
        }
      })
    }, 500)
  },
  created() {
    queryDataCode({ itemCodes: "BaseRemindType,BaseNoticeType,BaseRemindUnitType" }).then(res => {
      this.remindTypeList = res.result.BaseRemindType
      this.noticeTypeList = res.result.BaseNoticeType
      this.remindUnitTypeList = res.result.BaseRemindUnitType
    })
    /** 查询会议类型树 */
    getAction(this.url.queryMeetTypeList, { isAddRoot: false }).then(res => {
      if (res.success) {
        let reg = new RegExp("id", "g") // g代表全部
        this.meetTypeList = JSON.parse(JSON.stringify(res.result.dataList).replace(reg, "value"))
      }
    })
  }
}
</script>
<style scoped lang="scss">
.tag-container {
  .el-tag {
    margin-right: 5px;
  }
}
.color-block {
  display: inline-block;
  height: 15px;
  width: 15px;
}
.input-with-select {
  .el-select {
    width: 80px;
  }
}
</style>
<!-- 引入额外假table样式-->
<style scoped lang="sass">
@import '../../../styles/rwd-table.sass';
</style>
